import nProgress from 'nprogress'
import {
	createWebHashHistory,
	createRouter,
	RouteRecordRaw,
} from 'vue-router'

declare module 'vue-router' {
	interface RouteMeta {
		description: string,
		parentRouteName: string,
		showInAside: boolean, //是否在侧边导航栏显示
		showInHeader: boolean //是否在顶部面包屑显示
	}
}
export const routes: readonly RouteRecordRaw[] = [
	{
		path: '/',
		name: 'Index',
		redirect: '/home',
		meta: {
			description: 'index',
			parentRouteName: "",
			showInAside: false,
			showInHeader: false
		}
	},
	{
		path: '/home',
		name: 'Home',
		component: () => import('../views/Home.vue'),
		meta: {
			description: '首页',
			parentRouteName: "",
			showInAside: true,
			showInHeader: true
		}
	},
	
	{
		path: '/login',
		name: 'Login',
		component: () => import('../views/Login.vue'),
		meta: {
			description: '登陆',
			parentRouteName: "",
			showInAside: false,
			showInHeader: false
		}
	},
	{
		path: '/register',
		name: 'Register',
		component: () => import('../views/Register.vue'),
		meta: {
			description: '注册',
			parentRouteName: "",
			showInAside: false,
			showInHeader: false
		}
	},
	
	{
		path: '/hot',
		name: 'Hot',
		redirect:'/hot/weibo',
		component: () => import('../views/hot/Hot.vue'),
		meta: {
			description: '热搜查询',
			parentRouteName: "",
			showInAside: true,
			showInHeader: true
		},
		children: [
			{
				path: 'weibo',
				name: 'Weibo',
				component: () => import('../views/hot/Weibo.vue'),
				meta: {
					description: '微博热搜查询',
					parentRouteName: "Hot",
					showInAside: true,
					showInHeader: true
				}
			},
			{
				path: 'fenghuang',
				name: 'FengHuang',
				component: () => import('../views/hot/FengHuang.vue'),
				meta: {
					description: '凤凰网热榜查询',
					parentRouteName: "Hot",
					showInAside: true,
					showInHeader: true
				}
			},
			{
				path: 'baidu',
				name: 'Baidu',
				component: () => import('../views/hot/Baidu.vue'),
				meta: {
					description: '百度热搜查询',
					parentRouteName: "Hot",
					showInAside: true,
					showInHeader: true
				}
			},
			{
				path: 'bili',
				name: 'Bili',
				component: () => import('../views/hot/Bili.vue'),
				meta: {
					description: 'BiliBili热搜查询',
					parentRouteName: "Hot",
					showInAside: true,
					showInHeader: true
				}
			},
		]
	},
	{
		path: '/yunImage',
		name: 'YunImage',
		redirect:'/yunImage/uploadImage',
		component: () => import('../views/YunImage/YunImage.vue'),
		meta: {
			description: '云图床',
			parentRouteName: "",
			showInAside: true,
			showInHeader: true
		},
		children: [
			{
				path: 'uploadImage',
				name: 'UploadImage',
				component: () => import('../views/YunImage/UploadImage.vue'),
				meta: {
					description: '上传图片',
					parentRouteName: "YunImage",
					showInAside: true,
					showInHeader: true
				}
			},
			{
				path: 'myImage',
				name: 'MyImage',
				component: () => import('../views/YunImage/MyImage.vue'),
				meta: {
					description: '我的图片',
					parentRouteName: "YunImage",
					showInAside: true,
					showInHeader: true
				}
			},
			{
				path: 'category',
				name: 'Category',
				component: () => import('../views/YunImage/Category.vue'),
				meta: {
					description: '我的相册',
					parentRouteName: "YunImage",
					showInAside: true,
					showInHeader: true
				}
			},
			
			/* {
				path: 'myFavorite',
				name: 'MyFavorite',
				component: () => import('../views/YunImage/MyFavorite.vue'),
				meta: {
					description: '我的收藏',
					parentRouteName: "YunImage",
					showInAside: true,
					showInHeader: true
				}
			},
			{
				path: 'captcha',
				name: 'Captcha',
				component: () => import('../views/YunImage/Captcha.vue'),
				meta: {
					description: '验证码管理',
					parentRouteName: "YunImage",
					showInAside: true,
					showInHeader: true
				}
			}, */
		]
	},
	{
		path: '/chatRoom',
		name: 'ChatRoom',
		component: () => import('../views/ChatRoom.vue'),
		meta: {
			description: '聊天室',
			parentRouteName: "",
			showInAside: true,
			showInHeader: true
		}
	},
	
]
export const router = createRouter({
	history: createWebHashHistory(),
	routes
})

router.beforeEach((to, from) => {
	nProgress.start()
})

router.afterEach((to, from) => {
	nProgress.done()
})